package com.shaozi.nc.mq.substance;

import org.apache.log4j.Logger;
import org.json.JSONObject;

import com.shaozi.data.mq.business.base.SourceTypeConsts.OA.Approve;
import com.shaozi.data.mq.business.bean.MQExchangeRuleBean;
import com.shaozi.data.mq.business.bean.MQPushItem;
import com.shaozi.data.mq.business.bus.substance.BasePushSubstanceHandler;
import com.shaozi.lib.throwable.SzException;
import com.shaozi.nc.mq.bean.approve.ApproverAddComment;
import com.shaozi.nc.mq.bean.approve.ApproverReplyComment;
import com.shaozi.nc.mq.bean.approve.ApproverUpdateBean;
import com.shaozi.nc.mq.bean.approve.CommonBean;


/**
 * 审批
 * 
 * @author brenx
 *
 */
public class ApprovePushSubstance extends BasePushSubstanceHandler {
	private final Logger logger = Logger.getLogger(ApprovePushSubstance.class);

	public ApprovePushSubstance() {

	}

	@Override
	protected void onExchangeBiz(MQExchangeRuleBean pushData, MQPushItem pushItem, JSONObject jsonObj)
			throws SzException {
		switch (pushItem.getSourceType()) {
		case Approve.ApproverUpdate:
			exchangeBiz(pushData, jsonObj, ApproverUpdateBean.class);
			break;
		case Approve.AddComment:
			exchangeBiz(pushData, jsonObj, ApproverAddComment.class);
			break;
		case Approve.ReplyComment:
			exchangeBiz(pushData, jsonObj, ApproverReplyComment.class);
			break;
		default:
			exchangeBiz(pushData, jsonObj, CommonBean.class);
			break;
		}
	}

}
